package org.grow.present.dto;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author: xwg
 * @CreateDate: 2024/6/6
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageResults<T> {
    private Long total;
    private List<T> results;

    public static <U> PageResults<U> createByIPage(
            IPage<U> page) {
        PageResults<U> r = new PageResults<>();
        r.setResults(page.getRecords());
        r.setTotal(page.getTotal());
        return r;
    }

}
